1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.48">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0000ff}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000; min-height: 12.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0000bf}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco
; color: #000000; min-height: 16.0px}
18 span
.s1
{font: 18.0px Helvetica
}
19 span
.s2
{color: #000000}
20 span
.s3
{color: #0000bf}
21 span
.s4
{color: #007300}
22 span
.Apple-tab-span
{white-space:pre
}
26 <p class=
"p1"><span class=
"s1"><b>IndexL
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>index into a table with a signal, linear interpolated
</b></p>
27 <p class=
"p2"><br></p>
28 <p class=
"p1"><b>IndexL.ar(bufnum, in, mul, add)
</b></p>
29 <p class=
"p1"><b>IndexL.kr(bufnum, in, mul, add)
</b></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p1">The input signal value is truncated to an integer value and used as an index into the table.
</p>
32 <p class=
"p1">Out of range index values are clipped to the valid range.
</p>
33 <p class=
"p2"><br></p>
34 <p class=
"p1"><b>bufnum
</b> - index of the buffer
</p>
35 <p class=
"p1"><b>in
</b> - the input signal.
</p>
36 <p class=
"p2"><br></p>
37 <p class=
"p3"><span class=
"s2">See also:
<a href=
"IndexInBetween.html">IndexInBetween
</a></span></p>
38 <p class=
"p4"><br></p>
39 <p class=
"p5">// indexing into a fixed table
</p>
42 <p class=
"p7"><span class=
"s2"><span class=
"Apple-tab-span"> </span>SinOsc.ar(
</span></p>
43 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">IndexL
</span>.kr(
<span class=
"Apple-tab-span"> </span></p>
44 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">LocalBuf
</span>.newFrom([
200,
300,
400,
500,
600,
800 ].scramble),
</p>
45 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">LFSaw
</span>.kr(
2.0).range(
0,
7)
</p>
46 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>),
</p>
47 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,
</p>
48 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.5</p>
49 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
50 <p class=
"p6">}.play;
</p>
52 <p class=
"p4"><br></p>
53 <p class=
"p5">// with mouse control
</p>
56 <p class=
"p7"><span class=
"s2"><span class=
"Apple-tab-span"> </span>SinOsc.ar(
</span></p>
57 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">IndexL
</span>.kr(
<span class=
"Apple-tab-span"> </span></p>
58 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">LocalBuf
</span>.newFrom([
200,
300,
400,
500,
600,
800 ].scramble),
</p>
59 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">MouseX
</span>.kr(
0,
7)
</p>
60 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>),
</p>
61 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,
</p>
62 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.5</p>
63 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
64 <p class=
"p6">}.play;
</p>
66 <p class=
"p8"><br></p>
68 <p class=
"p5">// indexing into a changeable table
</p>
69 <p class=
"p6">s =
<span class=
"s3">Server
</span>.local;
</p>
70 <p class=
"p6">t = [
200,
300,
400,
500,
600,
800 ];
</p>
71 <p class=
"p6">b =
<span class=
"s3">Buffer
</span>(s, t.size,
1);
</p>
72 <p class=
"p4"><br></p>
73 <p class=
"p5">// alloc and set the values
</p>
74 <p class=
"p6">s.listSendMsg( b.allocMsg( b.setnMsg(
0, t) ).postln );
</p>
75 <p class=
"p4"><br></p>
76 <p class=
"p6"><span class=
"s3">SynthDef
</span>(
<span class=
"s4">\help_index
</span>, {
<span class=
"s3">arg
</span> out =
0, i_bufnum =
0;
<span class=
"Apple-converted-space"> </span></p>
77 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(
0,
</p>
78 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">SinOsc
</span>.ar(
</p>
79 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">IndexL
</span>.kr(
<span class=
"Apple-tab-span"> </span></p>
80 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i_bufnum,
</p>
81 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">LFSaw
</span>.kr(
2).range(
0,
7)
</p>
82 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>),
</p>
83 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,
</p>
84 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.5</p>
85 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
<span class=
"Apple-converted-space"> </span></p>
86 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
87 <p class=
"p6">}).play(s, [
<span class=
"s4">\i_bufnum
</span>, b]);
</p>
89 <p class=
"p4"><br></p>
90 <p class=
"p6">b.setn(*[
200,
300,
400,
500,
600,
800 ].scramble.postln -
30);
</p>
91 <p class=
"p4"><br></p>
92 <p class=
"p4"><br></p>
94 <p class=
"p6"><span class=
"s3">SynthDef
</span>(
<span class=
"s4">\help_index
</span>, {
<span class=
"s3">arg
</span> out=
0,i_bufnum=
0;
<span class=
"Apple-converted-space"> </span></p>
95 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(
0,
</p>
96 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">SinOsc
</span>.ar(
</p>
97 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">IndexL
</span>.kr(
<span class=
"Apple-tab-span"> </span></p>
98 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i_bufnum,
</p>
99 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">MouseX
</span>.kr(
0,
<span class=
"s3">BufFrames
</span>.ir(i_bufnum))
</p>
100 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>),
</p>
101 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,
</p>
102 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.5</p>
103 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
<span class=
"Apple-converted-space"> </span></p>
104 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
105 <p class=
"p6">}).play(s, [
<span class=
"s4">\i_bufnum
</span>, b]);
</p>
107 <p class=
"p4"><br></p>
108 <p class=
"p6">b.free;
</p>